﻿using System;
using Loki.Bot.Logic.Behaviors;
using Loki.Bot.Pathfinding;
using Loki.TreeSharp;

namespace toNyxIncinerate
{
    class Composites
    {

        #region LOS/Movement

        internal static Composite CreateMoveIntoRange(float range = 0)
        {

            // if range is set, return ranged behavior
            if (range > 0)
                return new Decorator(ret => Target.BestTarget.PathDistance() > range,
                                     CommonBehaviors.MoveTo(ret => Target.BestTarget.Position, ret => string.Format("CreateMoveIntoRange (Actual Distance to BestTarget : {0}, Needed : {1})", Target.BestTarget.PathDistance(), range)));

            return new Decorator(ret => Target.BestTarget.PathDistance() > AbilitySettings.Instance.CombatRange,
                                 CommonBehaviors.MoveTo(ret => Target.BestTarget.Position, ret => string.Format("CreateMoveIntoRange (Actual Distance to BestTarget : {0}, Needed : {1})", Target.BestTarget.PathDistance(), AbilitySettings.Instance.CombatRange), Convert.ToInt32(AbilitySettings.Instance.CombatRange)));
        }

        #endregion

    }
}
